package com.squid.templateProject.bean.req;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * Description
 *
 * @author jinhang
 * @since 2024-1-24
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageReq<T> {
    /**
     * 页码
     */
    @NotNull(message = "页码(pageNum)为必填项")
    @Min(value = 1, message = "页码(pageNum)不能小于1")
    private Integer pageNum = 1;

    /**
     * 每页显示数量
     */
    @Min(value = 1, message = "每页显示数量(pageSize)不能小于1")
    @Max(value = 5000, message = "每页显示数量(pageSize)不能大于5000")
    private Integer pageSize = 10;

    /**
     * 请求对象
     */
    @Valid
    @NotNull(message = "查询对象不能为空")
    private T request;
}
